﻿@model string
@{
    ViewData.TemplateInfo.HtmlFieldPrefix = ViewData.TemplateInfo.HtmlFieldPrefix.Replace(ViewData.ModelMetadata.PropertyName, "").Trim('.');
    var propertyName = ViewData["name"] == null ? ViewData.ModelMetadata.PropertyName : ViewData["name"].ToString();

    var editorHtmlAttributes = Html.GetUnobtrusiveValidationAttributes(propertyName, ViewData.ModelMetadata).Merge("class", "tinymce max").Merge(ViewData.ModelMetadata.AdditionalValues, true);
    var htmlAttributes = ViewBag.HtmlAttributes;
    if (htmlAttributes != null)
    {
        if (htmlAttributes is IDictionary<string, object>)
        {
            editorHtmlAttributes.Merge((IDictionary<string, object>)htmlAttributes);
        }
        else
        {
            editorHtmlAttributes.Merge(new RouteValueDictionary(htmlAttributes));
        }
    }
}
<tr>
    <th>
        <label for="@ViewData.TemplateInfo.GetFullHtmlFieldId(propertyName)">
            @ViewData.ModelMetadata.GetDisplayName().Localize()</label>
        @if (!string.IsNullOrEmpty(ViewData.ModelMetadata.Description))
        {
            <a href="#" class="tooltip-link" title="@ViewData.ModelMetadata.Description.Localize()"></a>
        }
    </th>
    <td>
        @Html.TextArea(propertyName, Model, editorHtmlAttributes)
        @Html.ValidationMessage(ViewData.ModelMetadata, new { name = ViewData["name"] })
        @if (!string.IsNullOrEmpty(ViewData.ModelMetadata.Description))
        {
            <em class="tip">@Html.Raw(ViewData.ModelMetadata.Description.Localize())</em>
        }
    </td>
</tr>
